<template>
    <div class="data-content">
        <table class="table -striped-col -breakall">
            <tbody>
                <tr>
                    <td rowspan="4" width="148px">法定代表人</td>
                    <td rowspan="4" class="left-col shadow">
                        {{ contentText.legalPersonName }}
                    </td>
                    <td width="148px">经营状态</td>
                    <td width="289px">
                        {{ contentText.regStatus }}
                    </td>
                    <td rowspan="3" width="147px">企业评分</td>
                    <td rowspan="3" width="147px">
                        {{ contentText.percentileScore / 100 }}
                    </td>
                </tr>
                <tr>
                    <td>成立日期</td>
                    <td title=" ">
                        {{ contentText.estiblishTime | formatDate }}
                    </td>
                </tr>
                <tr>
                    <td>注册资本</td>
                    <td title=" ">
                        {{ contentText.regCapital }}
                    </td>
                </tr>
                <tr>
                    <td>实缴资本</td>
                    <td title=" ">
                        {{ contentText.actualCapitalCurrency }}
                    </td>
                    <td>工商注册号</td>
                    <td>
                        {{ contentText.regNumber }}
                    </td>
                </tr>
                <tr>
                    <td>统一社会信用代码</td>
                    <td>
                        {{ contentText.creditCode }}
                    </td>
                    <td>纳税人识别号</td>
                    <td>
                        {{ contentText.taxNumber }}
                    </td>
                    <td>组织机构代码</td>
                    <td>
                        {{ contentText.orgNumber }}
                    </td>
                </tr>
                <tr>
                    <td>营业期限</td>
                    <td>
                        {{ contentText.estiblishTime | formatDate }}
                        至
                        {{ contentText.toTime | formatDate }}
                        <!-- {{ contentText.toTime ? ( contentText.toTime | formatDate) : '无固定期限'}} -->
                    </td>
                    <td>纳税人资质</td>
                    <td>-</td>
                    <td>核准日期</td>
                    <td>{{contentText.approvedTime | formatDate}}</td>
                </tr>
                <tr>
                    <td>公司类型</td>
                    <td>
                        {{contentText.companyOrgType}}
                        <!-- <div v-if="contentText.type == 1">人</div>
                        <div v-if="contentText.type == 2">公司</div> -->
                    </td>
                    <td>行业</td>
                    <td>
                        {{ contentText.industry }}
                    </td>
                    <td>人员规模</td>
                    <td>
                        {{ contentText.staffNumRange }}
                    </td>
                </tr>
                <tr>
                    <td>参保人数</td>
                    <td>
                        {{ contentText.socialStaffNum }}
                    </td>
                    <td>登记机关</td>
                    <td colspan="3">
                        {{ contentText.regInstitute }}
                    </td>
                </tr>
                <tr>
                    <td>曾用名</td>
                    <td>
                        {{ contentText.historyNames }}
                    </td>
                    <td>英文名称</td>
                    <td colspan="3">
                        {{ contentText.property3 }}
                    </td>
                </tr>
                <tr>
                    <td>注册地址</td>
                    <td colspan="5">
                        {{ contentText.regLocation }}
                    </td>
                </tr>
                <tr>
                    <td>经营范围</td>
                    <td colspan="5">
                        {{ contentText.businessScope }}
                    </td>
                </tr>
            </tbody>
        </table>
        <el-link v-if="!!contentText.legalPersonName" type="info" :underline="false">*此数据来源于天眼查官方网站</el-link>
    </div>
</template>

<script>
import { formatDate } from "../../js/common";

export default {
    props: {
        companyName: {
            type: String,
            default: "",
        },
        projectId: {
            type: String,
            default: "",
        },
        nodeId: { //导航标签id
            type: String,
            default: ''
        }
    },
    data: () => ({
        contentText: {},
    }),
    methods: {
        //获取企业基本信息
        getQiYeInfo() {
            var that = this;
            this.$ajax({
                type: "get",
                url: `${that.$store.state.api.searchUrl}/searchtianyan/baseinfo`,
                data: {
                    corpName: that.companyName.replace(/,$/, ''),
                    projectId: that.projectId,
                },
                callback: function (data, res) {
                    that.contentText = data.result;
                },
            });
        },
    },
    watch: {
        companyName() {
            this.getQiYeInfo();
        },
    },
    created() {
        this.getQiYeInfo();
    },
    filters: {
        formatDate(time) {
            let date = new Date(time);
            return formatDate(date, "yyyy-MM-dd");
        },
    },
};
</script>

<style scoped lang="scss">
.data-content {
    // border-bottom: 1px solid #efefef;
    padding:10px 0px;
}
</style>
